// @import '../../../antd/style/themes/index';
// @import '../../../antd/style/mixins/index';
@import './mixins.less';

@editable-table-prefix: ~'@{prefix}';

.@{editable-table-prefix}-container {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
}
.@{editable-table-prefix}-box {
  flex: 1;
}
.@{editable-table-prefix} {
  position: relative;
  color: @heading-color;
  font-size: @table-font-size;
  background: @table-bg;
  border-radius: @table-border-radius-base;
  border-spacing: 0;

  &-shadow {
    position: absolute;
    z-index: 10;
    transition: box-shadow 0.3s;
    pointer-events: none;

    &.left {
      top: 0;
      bottom: 0;
      left: 0;
      width: 30px;
      box-shadow: inset 10px 0 8px -8px rgba(0, 0, 0, 15%);
    }

    &.right {
      top: 0;
      right: 0;
      bottom: 0;
      width: 30px;
      box-shadow: inset -10px 0 8px -8px rgba(0, 0, 0, 15%);
    }

    &.bottom {
      right: 0;
      bottom: 0;
      left: 0;
      height: 30px;
      box-shadow: inset 0 -10px 18px -8px rgba(0, 0, 0, 15%);
    }
  }

  &-tr {
    display: inline-flex;
    flex: 1 0 auto;
    width: 100%;
    // min-width: 400px;
  }

  &-tr-content,
  &-tr-box {
    display: flex;
    flex: 1 0 auto;
  }
  // border 处理
  &-th {
    &.bordered {
      border-top: 1px solid @table-border-color;
    }

    &:first-of-type {
      border-top-left-radius: @table-border-radius-base;
    }

    &:last-of-type {
      border-top-right-radius: @table-border-radius-base;
    }
  }

  &-th,
  &-td {
    position: relative;
    margin: 0;
    padding: 11px 10px;
    line-height: 22px;
    white-space: nowrap;
    border-bottom: 1px solid @table-border-color;

    &.bordered {
      border-right: 1px solid @table-border-color;
    }

    &.leftShadow {
      box-shadow: -1px 0 3px rgba(0, 0, 0, 15%);
    }

    &.rightShadow {
      box-shadow: 1px 0 3px rgba(0, 0, 0, 15%);
    }
  }

  &-th,
  &-td,
  &-td-element {
    &.large {
      padding: 11px 10px;
    }

    &.middle {
      padding: 7px 10px;
    }

    &.small {
      padding: 3px 10px;
    }
  }

  &-th.bordered:first-of-type,
  &-td.bordered:first-of-type {
    border-left: 1px solid @table-border-color;
  }

  &-td {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    box-sizing: border-box;
    width: 150px;
    overflow: hidden;
    color: @heading-color;
    background: @table-bg;
  }

  &-td-content {
    display: block;
  }

  &-td-element {
    flex: 1 1 auto;
    box-sizing: content-box;
    // height: 30px;
    color: @heading-color;
    font-size: 14px;
    // line-height: 30px;
    white-space: pre-wrap;
    text-align: left;
    border: none;
    resize: none;

    &.left,
    .left {
      text-align: left;
    }

    &.center,
    .center {
      text-align: center;
    }

    &.right,
    .right {
      text-align: right;
    }

    &.ellipsis {
      overflow: hidden;
      white-space: nowrap;
      text-overflow: ellipsis;
    }
  }

  &-thead,
  &-summary {
    color: @table-header-color;
  }

  &-thead {
    display: flex;
    .@{editable-table-prefix}-th {
      position: relative;
      display: inline-block;
      box-sizing: border-box;
      width: 150px;
      // min-width: 100px;
      font-weight: 600;
      font-size: 14px;
      background-color: @table-header-bg;
      cursor: pointer;

      &:hover,
      &-sorted {
        background-color: rgb(240, 240, 240);
      }
    }
    .@{editable-table-prefix}-th-content {
      display: flex;
      align-items: center;
      overflow-x: hidden;
      text-overflow: ellipsis;
    }
    .@{editable-table-prefix}-th-render {
      width: 100%;
      text-align: left;

      &.left {
        text-align: left;
      }

      &.center {
        text-align: center;
      }

      &.right {
        text-align: right;
      }
    }
    .@{editable-table-prefix}-th-box {
      display: inline-flex;
      align-items: center;
    }
    .@{editable-table-prefix}-th-rule,
    .@{editable-table-prefix}-th-text,
    .@{editable-table-prefix}-th-edit,
    .@{editable-table-prefix}-th-sorter {
      display: inline-block;
      vertical-align: middle;
    }
    .@{editable-table-prefix}-th-rule {
      margin-right: 2px;
      color: red;
      font-size: 12px;
    }
    .@{editable-table-prefix}-th-edit {
      margin-left: 4px;
    }
    .@{editable-table-prefix}-th-resizer {
      position: absolute;
      top: 0;
      right: 0;
      width: 5px;
      height: 100%;
      background: rgba(0, 0, 0, 50%);
      cursor: col-resize;
      user-select: none;
      touch-action: none;

      &.isResizing {
        background: rgb(0, 0, 0);
        opacity: 1;
      }
    }
    .@{editable-table-prefix}-th-sorter {
      margin-left: 8px;
    }
    .@{editable-table-prefix}-th-asce {
      width: 0;
      height: 0;
      margin-bottom: 2px;
      border: 4px solid;
      border-color: transparent transparent rgba(0, 0, 0, 29%) transparent;

      &.asce-active {
        border-color: transparent transparent @primary-color transparent;
      }
    }
    .@{editable-table-prefix}-th-desc {
      width: 0;
      height: 0;
      border: 4px solid;
      border-color: rgba(0, 0, 0, 29%) transparent transparent transparent;

      &.desc-active {
        border-color: @primary-color transparent transparent transparent;
      }
    }
  }

  &-tbody {
    .@{editable-table-prefix}-tr {
      .@{editable-table-prefix}-td-sorted {
        background-color: @table-row-hover-bg;
      }
      &:hover .@{editable-table-prefix}-td {
        background-color: @table-row-hover-bg;
      }
    }
    .@{editable-table-prefix}-td-error {
      position: absolute;
      top: 1px;
      left: 1px;
      width: 0;
      height: 0;
      border-top: 10px solid red;
      border-right: 10px solid transparent;
      cursor: pointer;
    }
    .@{editable-table-prefix}-td-element {
      height: 32px;
      line-height: 32px;
    }
  }

  &-summary {
    .@{editable-table-prefix}-td {
      padding: 0;
    }
    .@{editable-table-prefix}-td-element {
      background-color: rgba(240, 170, 20, 16%);
    }
  }

  &-setting {
    display: flex;
    justify-content: center;
  }
}
.@{editable-table-prefix}-setting-modal {
  &-column-name {
    display: flex;
    align-items: center;
  }

  &-column-name__icon {
    display: flex;
    align-items: center;
    margin-left: 8px;
    transform: rotate(0);
    transform-origin: center;
    cursor: pointer;
    transition: all 0.25s ease-in;

    &.up {
      transform: rotate(180deg);
    }
  }
  .@{ant-prefix}-modal-body {
    padding: 0;
  }

  &-content {
    width: 100%;
    max-height: 420px;
    // padding: 0 14px;
  }
}
.@{editable-table-prefix}-pagination {
  display: flex;
  justify-content: flex-end;
  padding-top: 14px;
}
.@{editable-table-prefix}-cell {
  &__component {
    height: 32px;
  }

  &__modal {
    position: relative;
    display: flex;
    align-items: center;
  }

  &__modal--input {
    flex: 1;
  }

  &__modal--icon {
    color: @primary-color;
    cursor: pointer;
  }

  &__action {
    display: flex;
    align-items: center;
    justify-content: space-around;
    width: 100%;
    height: 100%;
  }

  &__action--icon {
    width: 20px;
    height: 20px;
    cursor: pointer;
  }
}
.@{editable-table-prefix}-scrollbar {
  &__track--vertical {
    position: absolute;
    top: 2px;
    right: 2px;
    bottom: 2px;
    z-index: 10;
    width: 6px;
    border-radius: 3px;

    & > div {
      z-index: 10;
    }
  }

  &__track--horizontal {
    position: absolute;
    right: 2px;
    bottom: 2px;
    left: 2px;
    height: 6px;
    border-radius: 3px;

    & > div {
      z-index: 10;
    }
  }
}
.@{editable-table-prefix}-nodata {
  display: flex;
  justify-content: center;
}
.@{editable-table-prefix}-select-table-modal {
  .@{ant-prefix}-modal-body {
    padding: 0;
  }

  &-content {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 630px;
    padding: 14px;
  }

  &-content-table {
    width: 100%;
  }

  &-content-pop {
    position: absolute;
    top: -51px;
    left: 0;
    z-index: 10;
    box-sizing: border-box;
    width: 100%;
    height: calc(100% + 51px);
  }

  &-content-pop-mark {
    width: 100%;
    height: 100%;
    cursor: pointer;
  }

  &-content-pop-table {
    position: absolute;
    top: 51px;
    left: 0;
    box-sizing: border-box;
    width: 100%;
    height: calc(100% - 51px);
    padding: 14px;
    background-color: #fff;
    box-shadow: 0 -6px 6px 2px rgba(0, 0, 0, 8%);
  }

  &-modal-table {
    flex: 1;
  }

  &-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
  }

  &-footer-text-box {
    display: flex;
    align-items: center;
    padding: 0 15px;
    cursor: pointer;
  }

  &-footer-text {
    margin-right: 8px;
    font-size: 16px;
  }

  &-footer-text-number {
    padding: 0 4px;
    color: #1da76a;
    font-weight: bold;
    font-size: 20px;
  }

  &-footer-text-icon {
    width: 24px;
    height: 24px;
    transform: rotate(-90deg);

    &.down {
      transform: rotate(90deg);
    }
  }
}
.@{editable-table-prefix}-select-table,
.@{editable-table-prefix}-modal-table {
  position: relative;
  display: flex;
  flex: 1;
  width: 100%;
  height: 100%;
}
.@{editable-table-prefix}-select-pop-modal {
  position: absolute;
  z-index: 100;
  display: none;
  width: 800px;
  height: 400px;
  background-color: #fff;
  border-radius: 4px;
  box-shadow: 1px 0 6px rgba(0, 0, 0, 15%);

  &.show {
    display: block;
  }

  &__table {
    width: 100%;
    height: 360px;
  }

  &__footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    box-sizing: border-box;
    padding: 4px 8px;
    border-top: 1px solid @table-border-color;
  }

  &__table--mark {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 10;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 45%);
  }
}
@media (hover: hover) {
  .@{editable-table-prefix}-th-resizer {
    opacity: 0;
  }

  *:hover > .@{editable-table-prefix}-th-resizer {
    opacity: 1;
  }
}
